﻿using RayDen.Library.Entity.SceneGraph;

namespace RayDen.Library.Entity.Scene
{
   

    public abstract class SceneBuilderComponentBase<TElement, TOwner> : DependentComponentBase, INodeVisitor, ISceneBuilderNodeHandler
        where TElement : SceneGraphElement
        where TOwner   : ISceneBuilder
    {
        public ISceneBuilder Owner
        {
            get { return this.BaseContainer.Get<TOwner>(); }
            set
            {
                this.BaseContainer.Populate(value);
            }
        }

        public SceneGraphInfo SceneGraph
        {
            get { return this.BaseContainer.Get<SceneGraphInfo>(); }
        }


        public void Setup(TOwner scn, SceneGraphInfo grp)
        {
            this.BaseContainer.Populate(scn, grp);
        }

        public void Visit(SceneGraphElement node)
        {
            if (node is TElement)
                this.VisitInternal((TElement)node);
        }

        protected abstract void VisitInternal(TElement node);
    }

 

}